3.5.86 \(\int (e \sec (c+d x))^{-1-n} (a+i a \tan (c+d x))^n \, dx\) [486]

Optimal. Leaf size=94 \[ \frac {i (e \sec (c+d x))^{-1-n} (a+i a \tan (c+d x))^n}{d (1-n)}-\frac {i (e \sec (c+d x))^{-1-n} (a+i a \tan (c+d x))^{1+n}}{a d \left (1-n^2\right )} \]

[Out]

I*(e*sec(d*x+c))^(-1-n)*(a+I*a*tan(d*x+c))^n/d/(1-n)-I*(e*sec(d*x+c))^(-1-n)*(a+I*a*tan(d*x+c))^(1+n)/a/d/(-n^
2+1)

________________________________________________________________________________________

Rubi [A]
time = 0.09, antiderivative size = 94, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {3585, 3569} \begin {gather*} \frac {i (a+i a \tan (c+d x))^n (e \sec (c+d x))^{-n-1}}{d (1-n)}-\frac {i (a+i a \tan (c+d x))^{n+1} (e \sec (c+d x))^{-n-1}}{a d \left (1-n^2\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(e*Sec[c + d*x])^(-1 - n)*(a + I*a*Tan[c + d*x])^n,x]

[Out]

(I*(e*Sec[c + d*x])^(-1 - n)*(a + I*a*Tan[c + d*x])^n)/(d*(1 - n)) - (I*(e*Sec[c + d*x])^(-1 - n)*(a + I*a*Tan
[c + d*x])^(1 + n))/(a*d*(1 - n^2))

Rule 3569

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(d*
Sec[e + f*x])^m*((a + b*Tan[e + f*x])^n/(a*f*m)), x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2, 0] &
& EqQ[Simplify[m + n], 0]

Rule 3585

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[a*(d*
Sec[e + f*x])^m*((a + b*Tan[e + f*x])^n/(b*f*(m + 2*n))), x] + Dist[Simplify[m + n]/(a*(m + 2*n)), Int[(d*Sec[
e + f*x])^m*(a + b*Tan[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2, 0] && IL
tQ[Simplify[m + n], 0] && NeQ[m + 2*n, 0]

Rubi steps

\begin {align*} \int (e \sec (c+d x))^{-1-n} (a+i a \tan (c+d x))^n \, dx &=\frac {i (e \sec (c+d x))^{-1-n} (a+i a \tan (c+d x))^n}{d (1-n)}+\frac {\int (e \sec (c+d x))^{-1-n} (a+i a \tan (c+d x))^{1+n} \, dx}{a (1-n)}\\ &=\frac {i (e \sec (c+d x))^{-1-n} (a+i a \tan (c+d x))^n}{d (1-n)}-\frac {i (e \sec (c+d x))^{-1-n} (a+i a \tan (c+d x))^{1+n}}{a d \left (1-n^2\right )}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.25, size = 58, normalized size = 0.62 \begin {gather*} -\frac {i (e \sec (c+d x))^{-1-n} (n-i \tan (c+d x)) (a+i a \tan (c+d x))^n}{d (-1+n) (1+n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(e*Sec[c + d*x])^(-1 - n)*(a + I*a*Tan[c + d*x])^n,x]

[Out]

((-I)*(e*Sec[c + d*x])^(-1 - n)*(n - I*Tan[c + d*x])*(a + I*a*Tan[c + d*x])^n)/(d*(-1 + n)*(1 + n))

________________________________________________________________________________________

Maple [C] Result contains higher order function than in optimal. Order 9 vs. order 3.
time = 1.06, size = 2490, normalized size = 26.49

method result size
risch \(\text {Expression too large to display}\) \(2490\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((e*sec(d*x+c))^(-1-n)*(a+I*a*tan(d*x+c))^n,x,method=_RETURNVERBOSE)

[Out]

1/2*exp(I*(d*x+c))^n*e^(-n)*a^n/e*exp(1/2*I*(2*c+n*Pi*csgn(I/(exp(2*I*(d*x+c))+1))*csgn(I*exp(I*(d*x+c)))*csgn
(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))+2*d*x+n*Pi*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^3-Pi*csgn(I*e/(
exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^2*csgn(I*e)-n*Pi*csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^2*csgn(I*e)
-n*Pi*csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^2*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))-n*Pi*csgn(I/
(exp(2*I*(d*x+c))+1))*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^2-n*Pi*csgn(I*exp(I*(d*x+c)))*csgn(I*exp(I*(
d*x+c))/(exp(2*I*(d*x+c))+1))^2+Pi*csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))*csgn(I*e)*csgn(I*exp(I*(d*x+c
))/(exp(2*I*(d*x+c))+1))-Pi*csgn(I/(exp(2*I*(d*x+c))+1))*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^2-Pi*csgn
(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^2*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))+n*Pi*csgn(I*e/(exp(2*I
*(d*x+c))+1)*exp(I*(d*x+c)))^3+Pi*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^3+Pi*csgn(I*e/(exp(2*I*(d*x+c))+
1)*exp(I*(d*x+c)))^3-Pi*csgn(I*a/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^3*n-Pi*csgn(I/(exp(2*I*(d*x+c))+1)*exp
(2*I*(d*x+c)))^3*n-Pi*csgn(I*exp(2*I*(d*x+c)))*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))*csgn(I/(exp(2*I*(
d*x+c))+1))*n-Pi*csgn(I*exp(I*(d*x+c)))*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^2-Pi*csgn(I*exp(2*I*(d*x+c
)))^3*n-Pi*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))*csgn(I*a/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))*csgn(
I*a)*n+Pi*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))*csgn(I*a/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^2*n+2*
Pi*csgn(I*exp(2*I*(d*x+c)))^2*csgn(I*exp(I*(d*x+c)))*n+n*Pi*csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))*csgn
(I*e)*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))+Pi*csgn(I/(exp(2*I*(d*x+c))+1))*csgn(I*exp(I*(d*x+c)))*csgn(
I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))+Pi*csgn(I*a/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^2*csgn(I*a)*n+Pi*csg
n(I*exp(2*I*(d*x+c)))*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^2*n-Pi*csgn(I*exp(2*I*(d*x+c)))*csgn(I*exp
(I*(d*x+c)))^2*n+Pi*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^2*csgn(I/(exp(2*I*(d*x+c))+1))*n))/(I*d+I*n*
d)+1/2*exp(I*(d*x+c))^n*e^(-n)*a^n/e*exp(-1/2*I*(2*c-n*Pi*csgn(I/(exp(2*I*(d*x+c))+1))*csgn(I*exp(I*(d*x+c)))*
csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))+2*d*x-n*Pi*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^3+Pi*csgn(I
*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^2*csgn(I*e)+n*Pi*csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^2*csgn(
I*e)+n*Pi*csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^2*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))+n*Pi*csg
n(I/(exp(2*I*(d*x+c))+1))*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^2+n*Pi*csgn(I*exp(I*(d*x+c)))*csgn(I*exp
(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^2-Pi*csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))*csgn(I*e)*csgn(I*exp(I*(d
*x+c))/(exp(2*I*(d*x+c))+1))+Pi*csgn(I/(exp(2*I*(d*x+c))+1))*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^2+Pi*
csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^2*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))-n*Pi*csgn(I*e/(exp
(2*I*(d*x+c))+1)*exp(I*(d*x+c)))^3-Pi*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^3-Pi*csgn(I*e/(exp(2*I*(d*x+
c))+1)*exp(I*(d*x+c)))^3+Pi*csgn(I*a/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^3*n+Pi*csgn(I/(exp(2*I*(d*x+c))+1)
*exp(2*I*(d*x+c)))^3*n+Pi*csgn(I*exp(2*I*(d*x+c)))*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))*csgn(I/(exp(2
*I*(d*x+c))+1))*n+Pi*csgn(I*exp(I*(d*x+c)))*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))^2+Pi*csgn(I*exp(2*I*(d
*x+c)))^3*n+Pi*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))*csgn(I*a/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))*c
sgn(I*a)*n-Pi*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))*csgn(I*a/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^2*
n-2*Pi*csgn(I*exp(2*I*(d*x+c)))^2*csgn(I*exp(I*(d*x+c)))*n-n*Pi*csgn(I*e/(exp(2*I*(d*x+c))+1)*exp(I*(d*x+c)))*
csgn(I*e)*csgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))-Pi*csgn(I/(exp(2*I*(d*x+c))+1))*csgn(I*exp(I*(d*x+c)))*c
sgn(I*exp(I*(d*x+c))/(exp(2*I*(d*x+c))+1))-Pi*csgn(I*a/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^2*csgn(I*a)*n-Pi
*csgn(I*exp(2*I*(d*x+c)))*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^2*n+Pi*csgn(I*exp(2*I*(d*x+c)))*csgn(I
*exp(I*(d*x+c)))^2*n-Pi*csgn(I/(exp(2*I*(d*x+c))+1)*exp(2*I*(d*x+c)))^2*csgn(I/(exp(2*I*(d*x+c))+1))*n))/(-I*d
+I*n*d)

________________________________________________________________________________________

Maxima [A]
time = 0.57, size = 111, normalized size = 1.18 \begin {gather*} \frac {{\left ({\left (-i \, a^{n} n + i \, a^{n}\right )} \cos \left ({\left (d x + c\right )} {\left (n + 1\right )}\right ) + {\left (-i \, a^{n} n - i \, a^{n}\right )} \cos \left ({\left (d x + c\right )} {\left (n - 1\right )}\right ) + {\left (a^{n} n - a^{n}\right )} \sin \left ({\left (d x + c\right )} {\left (n + 1\right )}\right ) + {\left (a^{n} n + a^{n}\right )} \sin \left ({\left (d x + c\right )} {\left (n - 1\right )}\right )\right )} e^{\left (-n\right )}}{2 \, {\left (n^{2} e - e\right )} d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(-1-n)*(a+I*a*tan(d*x+c))^n,x, algorithm="maxima")

[Out]

1/2*((-I*a^n*n + I*a^n)*cos((d*x + c)*(n + 1)) + (-I*a^n*n - I*a^n)*cos((d*x + c)*(n - 1)) + (a^n*n - a^n)*sin
((d*x + c)*(n + 1)) + (a^n*n + a^n)*sin((d*x + c)*(n - 1)))*e^(-n)/((n^2*e - e)*d)

________________________________________________________________________________________

Fricas [A]
time = 0.40, size = 128, normalized size = 1.36 \begin {gather*} \frac {{\left ({\left (-i \, n + i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - i \, n - i\right )} \left (\frac {2 \, e^{\left (i \, d x + i \, c + 1\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{-n - 1} e^{\left (i \, d n x + i \, c n + n \log \left (a e^{\left (-1\right )}\right ) + n \log \left (\frac {2 \, e^{\left (i \, d x + i \, c + 1\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )\right )}}{d n^{2} + {\left (d n^{2} - d\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(-1-n)*(a+I*a*tan(d*x+c))^n,x, algorithm="fricas")

[Out]

((-I*n + I)*e^(2*I*d*x + 2*I*c) - I*n - I)*(2*e^(I*d*x + I*c + 1)/(e^(2*I*d*x + 2*I*c) + 1))^(-n - 1)*e^(I*d*n
*x + I*c*n + n*log(a*e^(-1)) + n*log(2*e^(I*d*x + I*c + 1)/(e^(2*I*d*x + 2*I*c) + 1)))/(d*n^2 + (d*n^2 - d)*e^
(2*I*d*x + 2*I*c) - d)

________________________________________________________________________________________

Sympy [A]
time = 16.38, size = 296, normalized size = 3.15 \begin {gather*} \frac {\begin {cases} \frac {x \left (e \sec {\left (c \right )}\right )^{- n} \left (i a \tan {\left (c \right )} + a\right )^{n}}{\sec {\left (c \right )}} & \text {for}\: d = 0 \\\frac {d e x \tan {\left (c + d x \right )}}{2 a d \tan {\left (c + d x \right )} - 2 i a d} - \frac {i d e x}{2 a d \tan {\left (c + d x \right )} - 2 i a d} + \frac {e}{2 a d \tan {\left (c + d x \right )} - 2 i a d} & \text {for}\: n = -1 \\\frac {a x \tan ^{2}{\left (c + d x \right )}}{2 e \sec ^{2}{\left (c + d x \right )}} + \frac {a x}{2 e \sec ^{2}{\left (c + d x \right )}} + \frac {a \tan {\left (c + d x \right )}}{2 d e \sec ^{2}{\left (c + d x \right )}} - \frac {i a}{2 d e \sec ^{2}{\left (c + d x \right )}} & \text {for}\: n = 1 \\- \frac {i n \left (i a \tan {\left (c + d x \right )} + a\right )^{n}}{d n^{2} \left (e \sec {\left (c + d x \right )}\right )^{n} \sec {\left (c + d x \right )} - d \left (e \sec {\left (c + d x \right )}\right )^{n} \sec {\left (c + d x \right )}} - \frac {\left (i a \tan {\left (c + d x \right )} + a\right )^{n} \tan {\left (c + d x \right )}}{d n^{2} \left (e \sec {\left (c + d x \right )}\right )^{n} \sec {\left (c + d x \right )} - d \left (e \sec {\left (c + d x \right )}\right )^{n} \sec {\left (c + d x \right )}} & \text {otherwise} \end {cases}}{e} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))**(-1-n)*(a+I*a*tan(d*x+c))**n,x)

[Out]

Piecewise((x*(I*a*tan(c) + a)**n/((e*sec(c))**n*sec(c)), Eq(d, 0)), (d*e*x*tan(c + d*x)/(2*a*d*tan(c + d*x) -
2*I*a*d) - I*d*e*x/(2*a*d*tan(c + d*x) - 2*I*a*d) + e/(2*a*d*tan(c + d*x) - 2*I*a*d), Eq(n, -1)), (a*x*tan(c +
 d*x)**2/(2*e*sec(c + d*x)**2) + a*x/(2*e*sec(c + d*x)**2) + a*tan(c + d*x)/(2*d*e*sec(c + d*x)**2) - I*a/(2*d
*e*sec(c + d*x)**2), Eq(n, 1)), (-I*n*(I*a*tan(c + d*x) + a)**n/(d*n**2*(e*sec(c + d*x))**n*sec(c + d*x) - d*(
e*sec(c + d*x))**n*sec(c + d*x)) - (I*a*tan(c + d*x) + a)**n*tan(c + d*x)/(d*n**2*(e*sec(c + d*x))**n*sec(c +
d*x) - d*(e*sec(c + d*x))**n*sec(c + d*x)), True))/e

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(-1-n)*(a+I*a*tan(d*x+c))^n,x, algorithm="giac")

[Out]

integrate((e*sec(d*x + c))^(-n - 1)*(I*a*tan(d*x + c) + a)^n, x)

________________________________________________________________________________________

Mupad [B]
time = 1.89, size = 121, normalized size = 1.29 \begin {gather*} -\frac {{\left (\frac {a\,\left (\cos \left (2\,c+2\,d\,x\right )+1+\sin \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}\right )}{\cos \left (2\,c+2\,d\,x\right )+1}\right )}^n\,\left (\sin \left (c+d\,x\right )+\sin \left (3\,c+3\,d\,x\right )+n\,\cos \left (c+d\,x\right )\,3{}\mathrm {i}+n\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}\right )}{2\,d\,e\,\left (\cos \left (2\,c+2\,d\,x\right )+1\right )\,\left (n^2-1\right )\,{\left (\frac {e}{\cos \left (c+d\,x\right )}\right )}^n} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*tan(c + d*x)*1i)^n/(e/cos(c + d*x))^(n + 1),x)

[Out]

-(((a*(cos(2*c + 2*d*x) + sin(2*c + 2*d*x)*1i + 1))/(cos(2*c + 2*d*x) + 1))^n*(sin(c + d*x) + sin(3*c + 3*d*x)
 + n*cos(c + d*x)*3i + n*cos(3*c + 3*d*x)*1i))/(2*d*e*(cos(2*c + 2*d*x) + 1)*(n^2 - 1)*(e/cos(c + d*x))^n)

________________________________________________________________________________________